#!/bin/csh -f
# script to copy the contents of a directory (as listed on a file '.export'
# in that directory) to the export target directory
# argument: export directory root (new aqua root)
# note: run this script from the TOP of the directory tree to be exported;
#       the exported directory should be a sub-directory or .;
#       sub-sub-...directories are permissible, but they have to be
#       created in the proper order



if ( $#argv != 1 ) then
    echo "usage: export  export_dir_root"
    exit (1)
endif

if ( ! -d $1 ) then
    echo $1 "is not a directory"
    exit (1)
endif

#foreach dir ( . data doc exmpls extras lib scripts procheck src )
#foreach dir ( . src data doc exmpls extras lib scripts ) # All but server
foreach dir ( . src data doc exmpls extras scripts \
            sub sub/lib\
            html cgi server server/img )

    if ( ! -d $dir ) then
	echo $dir "is not a directory"
	exit (1)
    endif

    mkdir $1/$dir
    echo "created $1/$dir"
    foreach x (`cat $dir/.export`)
	echo "       copying" $x 
	cp $x $1/$dir
    end

end

mkdir $1/bin
echo "created $1/bin"
